import { exportProject } from '../utils/exportManager';
import type { CanvasComponent } from '../stores/designStore';

// 示例组件数据
const exampleComponents: CanvasComponent[] = [
  {
    id: '1',
    type: 'div',
    style: {
      width: '100%',
      height: '100%',
      display: 'flex',
      flexDirection: 'column',
      padding: '20px'
    },
    children: [
      {
        id: '2',
        type: 'el-button',
        style: {
          marginBottom: '20px'
        },
        attrs: {
          type: 'primary',
          text: '测试按钮'
        }
      },
      {
        id: '3',
        type: 'el-input',
        style: {
          marginBottom: '20px'
        },
        attrs: {
          placeholder: '请输入内容'
        }
      },
      {
        id: '4',
        type: 'el-switch',
        style: {
          marginBottom: '20px'
        },
        attrs: {
          activeText: '开启',
          inactiveText: '关闭'
        }
      }
    ]
  }
];

// 导出示例
async function exportExample() {
  try {
    // 导出为 HTML 文件
    await exportProject({
      type: 'html',
      outputDir: './output/html',
      productName: '测试应用',
      components: exampleComponents
    });

    // 导出为 Miniblink 项目
    await exportProject({
      type: 'miniblink',
      outputDir: './output/miniblink',
      productName: '测试应用',
      components: exampleComponents
    });

    console.log('导出成功！');
  } catch (error) {
    console.error('导出失败:', error);
  }
}

// 运行导出示例
exportExample(); 